<template>
  <div class="learnIndex">
    <div class="content">
      <div class="bigBox">
        <div class="bigBox2">
          <div
            @click="go1(index)"
            class="box"
            v-for="(item,index) of data"
            :key="item.id"
            :class="answer(item.option)?'add':''"
          >{{index+1}}</div>
        </div>
      </div>

      <div class="btn" @click="go">继续答题</div>
    </div>
  </div>
</template>

<script>
import { debug } from "util";
export default {
  data() {
    return {
      listData: [],
      data: JSON.parse(localStorage.getItem("subject")).subject,
      select: false
    };
  },
  mounted() {
    this.$progress.done();
  },
  filters: {
    two: function(e) {
      e = e + "";
      return e.padStart(2, "0");
    }
  },

  methods: {
    answer(option) {
      let bool = false;
      option.forEach(e => {
        if (e.answer) {
           bool = true
        }
      });
     return bool
    },
    go() {
      this.$router.go(-1);
    },
    go1(index) {

      // this.select = true;
      // this.$router.replace({
      //   path: "/learn/answer",
      //   query: {
      //     index: index,
      //     id: this.$route.query.id
      //   }
      // });
    }
  }
};
</script>

<style scoped lang="scss">
* {
  margin: 0;
  padding: 0;
}
.learnIndex {
  position: relative;
  background: url("~@as/img/xuexi_datizhuangkuang_bg@2x.png");
  background-size: 100% 100%;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 0;

  .btn {
    margin-top: 34px;
    width: 287px;
    height: 36px;
    background: #eb4d44;
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;

    position: absolute;
    bottom: 35px;
    left: 50%;
    margin-left: -143.5px;
  }
  .content {
    position: relative;
    width: 335px;
    height: 562px;
    background: #fff;
    margin-top: 82px;
    border-radius: 4px;
    padding: 20px 10px 20px 18px;
  }
  .bigBox {
    width: 100%;
    display: flex;
    height: 450px;
    align-items: flex-start;
    overflow-y: scroll;
  }
  .bigBox2 {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
  }
  .box {
    width: 30px;
    height: 30px;
    margin: 15px;
    font-size: 14px;
    color: #999999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
  }

  .add {
    color: #666666;
    background: #ddd;
  }
}
</style>